'use strict';

const Controller = require('egg').Controller;


class UserController extends Controller {
    async getAll() {

        const { ctx } = this;

        ctx.body = await ctx.service.user.getAll();


    }

    async createUser() {
        const { ctx } = this;
        let obj = { name: "君君1", sex: "男" };
        ctx.body = await ctx.service.user.createUser(obj);

    }

    async deleteUser() {
        const { ctx } = this;

        ctx.body = await ctx.service.user.deleteUser(3);

    }

    async  updateUser() {
        const { ctx } = this;
        let obj = { id: 2, name: "君君1", sex: "女" };
        ctx.body = await ctx.service.user.updateUser(obj);
        ctx.body = obj;
    }

    async associate() {
        const { ctx } = this;
        ctx.body = await ctx.service.user.associate();
    }

    async query() {
        const { ctx } = this;
        ctx.body = await ctx.service.user.query();
    }
}

module.exports = UserController;
